//
//  ShuangSeQiuNumber.m
//  PlayBall
//
//  Created by Edward Zhang on 12-6-7.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddShuangSeQiuNumber.h"

@implementation JddShuangSeQiuNumber

@synthesize redBallArray;
@synthesize blueBallArray;

- (id)init{
    self = [super init];
    
    if (self) {
        self.redBallArray = [NSMutableArray array];
        self.blueBallArray = [NSMutableArray array];
    }
    
    return self;
}

- (NSInteger)addRedBallNumber:(NSInteger)number{
    [redBallArray addObject:[NSNumber numberWithInt:number]];
    
    return [redBallArray count];
}

- (NSInteger)addBlueBallNumber:(NSInteger)number{
    [blueBallArray addObject:[NSNumber numberWithInt:number]];

    return [blueBallArray count];
}

- (NSInteger)removeRedBallNumber:(NSInteger)number{
    for (NSNumber *inNumber in redBallArray) {
        if ([inNumber intValue] == number) {
            [redBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [redBallArray count];
}

- (NSInteger)removeBlueBallNumber:(NSInteger)number{
    for (NSNumber *inNumber in blueBallArray) {
        if ([inNumber intValue] == number) {
            [blueBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [blueBallArray count];
}

- (void)clear{
    [redBallArray removeAllObjects];
    [blueBallArray removeAllObjects];
}

- (void)clearRedBallNumber{
    [redBallArray removeAllObjects];
}

- (void)clearBlueBallNumber{
    [blueBallArray removeAllObjects];
}

- (BOOL)redBallHasNumber:(NSInteger)number{
    for (NSNumber *inNumber in redBallArray) {				
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;
}

- (BOOL)blueBallHasNumber:(NSInteger)number{
    for (NSNumber *inNumber in blueBallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;
}

@end
